package org.msz.framework.security.handle;

import com.alibaba.fastjson2.JSON;
import org.msz.common.constant.Constants;
import org.msz.common.constant.HttpStatus;
import org.msz.common.core.domain.AjaxResult;
import org.msz.common.core.domain.model.LoginUser;
import org.msz.common.utils.ServletUtils;
import org.msz.common.utils.StringUtils;
import org.msz.framework.manager.AsyncManager;
import org.msz.framework.manager.factory.AsyncFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 自定义退出处理类 返回成功
 *
 * 
 */
@Configuration
public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {


    /**
     * 退出处理
     *
     * @return
     */
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
            throws IOException, ServletException
    {
        try {
            request.logout();
        } catch (ServletException e) {
        }
//
            // 删除用户缓存记录

            // 记录用户退出日志
    }
}
